#{extends 'main.html' /}

<h1>${profileUser.firstname}'s Profile</h1>
<br>
<ul id="profile">
 <!-- CSS Tabs -->
 <li><a href="@{Profile.show(profileUser.id, "ABOUT")}">About</a></li>
 <li><a href="@{Profile.show(profileUser.id, "OFFERS")}">Offers</a></li>
</ul>
<br>
#{if view == controllers.Profile$View.ABOUT || view == null}
<table id="profile" border="0">
 <tr>
  <td id="bold">email</td>
  <td>${profileUser.email}</td>
 </tr>
 #{if profileUser.getClass() == models.CommercialOfferer.class}
   <tr>
  <td id="bold">hotel name</td>
  <td>${profileUser.hotelname}</td>
 </tr>
  <tr>
  <td id="bold">hotel link</td>
  <td>${profileUser.hotellink}</td>
 </tr>
  <tr>
  <td id="bold">stars</td>
  <td>${profileUser.stars}</td>
 </tr>
 #{/if}
 #{if user && (user.email == profileUser.email)}
 <tr>
  <td id="bold">first name</td>
  <td>${profileUser.firstname}</td>
 </tr>
 <tr>
  <td id="bold">last name</td>
  <td>${profileUser.lastname}</td>
 </tr>
 <tr>
  <td id="bold">date of birth</td>
  <td>${profileUser.dateOfBirth.format('dd.MM.yyyy')}</td>
 </tr>
 <tr>
  <td id="bold">street</td>
  <td>${profileUser.street}</td>
 </tr>
 <tr>
  <td id="bold">street number</td>
  <td>${profileUser.streetNumber}</td>
 </tr>
 <tr>
  <td id="bold">city</td>
  <td>${profileUser.city}</td>
 </tr>
 <tr>
  <td id="bold">zip code</td>
  <td>${profileUser.zipcode}</td>
 </tr>
 <tr>
  <td id="bold">telephone</td>
  <td>${profileUser.telephone}</td>
 </tr>
 #{/if}
</table>
#{if user && (user.email == profileUser.email)}
 <a class="text" href="@{Profile.editProfile(profileUser.id)}">edit profile</a>
#{/if} #{/if} #{else}
<h3>Offers:</h3>
#{list items:offers, as:'offer'}
<br>
Start Date: ${offer.startDate.toLocaleString().substring(0,10)}
<br>
End Date: ${offer.endDate.toLocaleString().substring(0,10)}
<br>
Event: ${offer.event.name} Premium? #{if offer.premium ==
true}Yes#{/if}#{else}No#{/else}
<br>
<a class="text" href="@{Offers.show(offer.id)}">&nbsp;Show
 Offer&nbsp;</a>
#{if user && (user.email == profileUser.email)}
<a class="text" href="@{Offers.edit(offer.id)}">&nbsp;Edit
 Offer&nbsp;</a>
<a class="text" href="@{Offers.delete(offer.id)}">&nbsp;Delete
 Offer&nbsp;</a>
#{/if}
<br>
#{/list} #{/else}
